- expanded = expanded_by_default?
%section.settings.js-service-desk-setting-wrapper.no-animate#js-service-desk{ class: ('expanded' if expanded), data: { qa_selector: 'service_desk_settings_content' } }
  .settings-header
    %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Service Desk')
    = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do
      = expanded ? _('Collapse') : _('Expand')
    - link_start = "<a href='#{help_page_path('user/project/service_desk')}' target='_blank' rel='noopener noreferrer'>".html_safe
    %p= _('Enable and disable Service Desk. Some additional configuration might be required. %{link_start}Learn more%{link_end}.').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
  .settings-content
    - if ::Gitlab::ServiceDesk.supported?
      .js-service-desk-setting-root{ data: { endpoint: project_service_desk_path(@project),
        enabled: "#{@project.service_desk_enabled}",
        issue_tracker_enabled: "#{@project.project_feature.issues_enabled?}",
        incoming_email: (@project.service_desk_incoming_address if @project.service_desk_enabled),
        service_desk_email: (@project.service_desk_custom_address if @project.service_desk_enabled),
        service_desk_email_enabled: "#{Gitlab::Email::ServiceDeskEmail.enabled?}",
        selected_template: "#{@project.service_desk_setting&.issue_template_key}",
        selected_file_template_project_id: "#{@project.service_desk_setting&.file_template_project_id}",
        outgoing_name: "#{@project.service_desk_setting&.outgoing_name}",
        project_key: "#{@project.service_desk_setting&.project_key}",
        templates: available_service_desk_templates_for(@project),
        public_project: "#{@project.public?}",
        custom_email_endpoint: project_service_desk_custom_email_path(@project) } }
    - elsif show_callout?('promote_service_desk_dismissed')
      = render 'shared/promotions/promote_servicedesk'
